#include <iostream>
using namespace std;
const int N = 1e5 + 10;
int arr[N];

int main() {
    int n;
    cin >> n;
    int ans = 0;
    int i = 0;
    //cout << n <<endl;
    while (i < n)
    {
        if (i == n - 1)
        {
            ans++;
            break;
        }
        if (arr[i] < arr[i + 1])
        {
            while (i < n - 1 && arr[i] <= arr[i + 1]) i++;


            ans++;
        }
        else if (arr[i] > arr[i + 1])
        {
            while (i < n - 1 && arr[i] >= arr[i + 1])  i++;
            ans++;
        }
        else
        {
            while (i < n - 1 && arr[i] == arr[i + 1])  i++;
        }
        i++;
    }
    cout << ans << endl;


    return 0;
}